//
// Created by gxx on 2023/11/11.
//

#ifndef TINY_DB_BASE_TYPES_H
#define TINY_DB_BASE_TYPES_H

#include <string>

namespace TinyDB {

typedef char           t_char;
typedef unsigned long  t_uint64;
typedef unsigned long  t_uintptr;
typedef long           t_int64;
typedef unsigned int   t_uint32;
typedef int            t_int32;
typedef unsigned short t_uint16;
typedef short          t_int16;
typedef unsigned char  t_uint8;
typedef char           t_int8;
typedef bool           t_bool;
typedef char           t_byte;
typedef std::string    t_string;
typedef void           t_void;

#define T_ASSERT(exp) assert((exp))

// 锁


// 文件权限
#define T_WRONLY 1
#define T_RDONLY 2
#define T_RDWR   4
#define T_CREAT  8
#define T_EXCL   16
#define T_APPEND 32

enum retcode {
	EXECUTE_SUCCESS = 0,
	EXECUTE_FAILED,
	FILE_OPEN_FAILED
};

typedef retcode t_retcode;

#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

#define GET_BIT(DATA, IDX) ((1U << IDX) & DATA) >> IDX

#define SET_BIT_1(DATA, IDX) ((1U << IDX) | DATA)
#define SET_BIT_0(DATA, IDX) (~(1U << IDX) & DATA)
}

#endif //TINY_DB_BASE_TYPES_H
